package ch12.test;

import java.io.File;
import java.io.FilePermission;
import java.io.ObjectInputStream.GetField;

public class FindClass {

	public static void main(String[] args) {
		String path = "D:\\temp";
		System.out.println("路径是"+path+"的文件夹内的文件有：");
		
		find(path);
	}
	
	public static void find(String path) {
		File file = new File(path);
		
		if(file.isDirectory()) {
			File[] files = file.listFiles();
			
			for(int i=0;i<files.length;i++) {
				if(files[i].isDirectory()) {

					System.out.println("文件名: "+files[i].getName());
					System.out.println("路径名: "+files[i].getPath());
					find(files[i].getPath());
					
				}else {
					System.out.println("文件名: "+files[i].getName());
					System.out.println("路径名: "+files[i].getPath());
				}
				
			}
		}else {
			System.out.println("文件名: "+file.getName());
			System.out.println("路径名: "+file.getPath());
		}
	}
		
		
		

}
